/**
 * author:Administrator
 * date:2016/2/26
 * desc: 消费者 query 接口
 */

"use strict";

let query = require('../infrastructure/query');
let VendorShopDetail = require('../domain/model_query/VendorShopDetail.js');
let VendorWareDetail = require('../domain/model_query/VendorWareDetail.js');

class VendorQueryService {

  * wareOfVendor(vendorId) {
    return yield query.ware.findByVendor(vendorId);
  }

  * shopOfVendor(vendorId) {
    return yield query.shop.findByVendor(vendorId);
  }

  * wareDetail(vendorId, wareId) {
    let qData = yield query.ware.vendorWareDetail(vendorId, wareId);
    return new VendorWareDetail(qData);
  }

  * shopDetail(vendorId, shopId) {
    let qData = yield query.shop.vendorShopDetail(vendorId, shopId);
    return new VendorShopDetail(qData);
  }
}
module.exports = new VendorQueryService();

